package com.goldgov.msservice.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.goldgov.kcloud.core.json.JsonObject;
import com.goldgov.kcloud.core.json.JsonSuccessObject;

import com.goldgov.msservice.service.msservice;
import com.goldgov.msservice.service.msserviceService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

@RestController
@RequestMapping("/ms-service")
@Api("msservice服务接口")
public class msserviceController {
	
	@Autowired
	private msserviceService service;
	
	@PostMapping
	@ApiOperation(value = "msservice保存", notes ="msservice描述")
	public JsonObject<Object> addmsservice(msservice obj){
		//TODO 完善代码实现
		service.addmsservice(obj);
		return JsonSuccessObject.SUCCESS;
	}
	
	@DeleteMapping
	@ApiOperation(value = "msservice删除", notes ="msservice描述")
	public JsonObject<Object> deletemsservice(@ApiParam(value = "msserviceID", required = true) @RequestParam("ids") String[] ids){
		//TODO 完善代码实现
		service.deletemsservice(ids);
		return JsonSuccessObject.SUCCESS;
	}
	
	@PutMapping
	@ApiOperation(value = "msservice修改", notes ="msservice描述")
	public JsonObject<Object> updatemsservice(msservice obj) {
		//TODO 完善代码实现
		service.updatemsservice(obj);
		return JsonSuccessObject.SUCCESS;
	}
	
	@GetMapping("/{id}")
	@ApiOperation(value = "根据主键查询msservice", notes ="msservice描述")
	public JsonSuccessObject<msservice> getmsservice(@ApiParam(value="msserviceID",required=false) @PathVariable("id") String id){
		//TODO 完善代码实现
		msservice obj = service.getmsservice(id);
		JsonSuccessObject<msservice> returnResult = new JsonSuccessObject<>(obj);
		return returnResult;
	}
	
}